import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const publish =[
  {
    path:'/home/publish/newTask',
    name:'newTask',
    component:()=>import('@/views/publish/newTask.vue')
  },
  {
    path:'/home/publish/updataTask',
    name:'updataTask',
    component:()=>import('@/views/updataTask')
  },
  {
    path:'/home/mine/Myorder',
    name:'Myorder',
    component:()=>import('@/views/mine/page/Myorder')
  },
  {
    path:'/home/mine/collection',
    name:'collection',
    component:()=>import('@/views/mine/page/collection')
  },
  {
    path:'/home/message/chartpage',
    name:'chartpage',
    component:()=>import('@/views/message/chartpage/chartpage')
  }
]
const routes = [
  {
    path:'/',
    redirect:'/home'
  },
  {
    path:'/home',
    name:'home',
    component:()=>import('@/views/home'),
    children:[
      {
        path:'/',
        redirect:'substitute'
      },
    {
      path:'mine',
      name:'mine',
      component:()=>import('@/views/mine')
    },
    {
      path: 'substitute',
      name: 'substitute',
      component: () => import('@/views/substitute'),
    },
    {
      path: 'publish',
      name: 'publish',
      component: () => import('@/views/publish')
    },
    {
      path: 'message',
      name: 'message',
      component: () => import('@/views/message')
    },
    
    ]
  },
  {
    path:'/login',
    name:'login',
    component:()=>import('@/views/login/login.vue')
  },
  {
    path:'/home/substitute/detail',
    name:'detail',
    component:()=>import('@/views/detail')
  },
  ...publish
]


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
